import request from '@/config/axios'

// 申请 VO
export interface JkOrderVO {
  id: number // id
  orderNo: string // 申请编号
  userId: number // 用户id
  userPhone: string // 用户登录账号
  userType: number // 用户类型
  realName: string // 真实姓名
  status: number // 申请状态
  address: string // 申请人地址
  contactName: string // 申请联系人
  contactPhone: string // 申请人联系手机
  receiveTime: Date // 样本领取时间
  rebackTime: Date // 样本归还时间
  receiveType: string // 样本领取方式
}

// 申请 API
export const JkOrderApi = {
  // 查询申请分页
  getJkOrderPage: async (params: any) => {
    return await request.get({ url: `/jikong/jk-order/page`, params })
  },
  getStatusCount: async () => {
    return await request.get({ url: `/jikong/jk-order/statusCount` })
  },

  // 查询个人分页
  getUserOrderPage: async (params: any) => {
    return await request.get({ url: `/jikong/jk-order/UserOrderPage`, params })
  },
  // 查询申请详情
  getJkOrder: async (id: number) => {
    return await request.get({ url: `/jikong/jk-order/get?id=` + id })
  },
  // 新增申请
  createJkOrder: async (data: JkOrderVO) => {
    return await request.post({ url: `/jikong/jk-order/create`, data })
  },

  // 修改申请
  updateJkOrder: async (data: JkOrderVO) => {
    return await request.put({ url: `/jikong/jk-order/update`, data })
  },
  // 修改申请状态
  updateStatus: async (data: any) => {
    return await request.put({ url: `/jikong/jk-order/updateStatus`, data })
  },

  // 删除申请
  deleteJkOrder: async (id: number) => {
    return await request.delete({ url: `/jikong/jk-order/delete?id=` + id })
  },

  // 导出申请 Excel
  exportJkOrder: async (params) => {
    return await request.download({ url: `/jikong/jk-order/export-excel`, params })
  }
}
